
<?php
/*include_once('init.php');*/
	if(!empty($_POST)) {
	/*	print_r($_POST);die;*/
		/*session_start();*/
		
		
			


		$where['news']=$_POST['news'];
		$where['pid']=$_POST['pid'];
		
		
		$row=add('cate',$where);

        if ($row>0) {
        	echo '<script>alert("添加成功");location.href="index.php?c=cate&a=news&admin=1";</script>';

        }else{
        	echo '<script>alert("添加失败");history.go(-1);</script>';die;
        }
		

	}

		$id=!empty($_GET['id'])?$_GET['id']:'0';
	/*$sql = "select * from `cate` where `pid`='$id'";
	$result=mysqli_query($link,$sql);
	while ($arr=mysqli_fetch_assoc($result)) {
		$cate[]=$arr;
	}*/
		$cate=gatselect('cate',"`pid`=$id");

        if (!empty($_SERVER['HTTP_X_REQUESTED_WITH'])) {

        
        	

        	echo json_encode($cate);die;
        	
        }



	include( VIEW_PATH.$admin.'layst.html');

?>
